bitkeeper revision 1.1159.1.64 (41206d44aLwz5oslqPWoV3gXftNh_A)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Mon, 16 Aug 2004 08:16:04 +0000 (08:16 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Mon, 16 Aug 2004 08:16:04 +0000 (08:16 +0000)
Fix PIRQ virtualisation for IRQS 64 to 127.

xen/arch/x86/irq.c

index 7835061a3a85a305327ebb96ce8cf5672c187e5a..2ed656549c28e07c9bb765c3a67f00b2af96c079 100644 (file)
@@ -195,36 +195,36 @@ static void __do_IRQ_guest(int irq)
 {
     irq_desc_t         *desc = &irq_desc[irq];
     irq_guest_action_t *action = (irq_guest_action_t *)desc->action;
-    struct domain *p;
+    struct domain      *d;
     int                 i;
 
     for ( i = 0; i < action->nr_guests; i++ )
     {
-        p = action->guest[i];
-        if ( !test_and_set_bit(irq, &p->pirq_mask) )
+        d = action->guest[i];
+        if ( !test_and_set_bit(irq, &d->pirq_mask) )
             action->in_flight++;
-        send_guest_pirq(p, irq);
+        send_guest_pirq(d, irq);
     }
 }
 
-int pirq_guest_unmask(struct domain *p)
+int pirq_guest_unmask(struct domain *d)
 {
     irq_desc_t    *desc;
     int            i, j, pirq;
     u32            m;
-    shared_info_t *s = p->shared_info;
+    shared_info_t *s = d->shared_info;
 
-    for ( i = 0; i < 2; i++ )
+    for ( i = 0; i < ARRAY_SIZE(d->pirq_mask); i++ )
     {
-        m = p->pirq_mask[i];
+        m = d->pirq_mask[i];
         while ( (j = ffs(m)) != 0 )
         {
             m &= ~(1 << --j);
             pirq = (i << 5) + j;
             desc = &irq_desc[pirq];
             spin_lock_irq(&desc->lock);
-            if ( !test_bit(p->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
-                 test_and_clear_bit(pirq, &p->pirq_mask) &&
+            if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
+                 test_and_clear_bit(pirq, &d->pirq_mask) &&
                  (--((irq_guest_action_t *)desc->action)->in_flight == 0) )
                 desc->handler->end(pirq);
             spin_unlock_irq(&desc->lock);
@@ -234,14 +234,14 @@ int pirq_guest_unmask(struct domain *p)
     return 0;
 }
 
-int pirq_guest_bind(struct domain *p, int irq, int will_share)
+int pirq_guest_bind(struct domain *d, int irq, int will_share)
 {
     irq_desc_t         *desc = &irq_desc[irq];
     irq_guest_action_t *action;
     unsigned long       flags;
     int                 rc = 0;
 
-    if ( !IS_CAPABLE_PHYSDEV(p) )
+    if ( !IS_CAPABLE_PHYSDEV(d) )
         return -EPERM;
 
     spin_lock_irqsave(&desc->lock, flags);
@@ -278,7 +278,7 @@ int pirq_guest_bind(struct domain *p, int irq, int will_share)
         /* Attempt to bind the interrupt target to the correct CPU. */
         if ( desc->handler->set_affinity != NULL )
             desc->handler->set_affinity(
-                irq, apicid_to_phys_cpu_present(p->processor));
+                irq, apicid_to_phys_cpu_present(d->processor));
     }
     else if ( !will_share || !action->shareable )
     {
@@ -295,14 +295,14 @@ int pirq_guest_bind(struct domain *p, int irq, int will_share)
         goto out;
     }
 
-    action->guest[action->nr_guests++] = p;
+    action->guest[action->nr_guests++] = d;
 
  out:
     spin_unlock_irqrestore(&desc->lock, flags);
     return rc;
 }
 
-int pirq_guest_unbind(struct domain *p, int irq)
+int pirq_guest_unbind(struct domain *d, int irq)
 {
     irq_desc_t         *desc = &irq_desc[irq];
     irq_guest_action_t *action;
@@ -313,7 +313,7 @@ int pirq_guest_unbind(struct domain *p, int irq)
 
     action = (irq_guest_action_t *)desc->action;
 
-    if ( test_and_clear_bit(irq, &p->pirq_mask) &&
+    if ( test_and_clear_bit(irq, &d->pirq_mask) &&
          (--action->in_flight == 0) )
         desc->handler->end(irq);
 
@@ -329,7 +329,7 @@ int pirq_guest_unbind(struct domain *p, int irq)
     else
     {
         i = 0;
-        while ( action->guest[i] != p )
+        while ( action->guest[i] != d )
             i++;
         memmove(&action->guest[i], &action->guest[i+1], IRQ_MAX_GUESTS-i-1);
         action->nr_guests--;